import org.apache.curator.RetryPolicy;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.CuratorFrameworkFactory;
import org.apache.curator.retry.ExponentialBackoffRetry;
import org.apache.zookeeper.CreateMode;
import org.junit.jupiter.api.Test;

public class Curator {
    @Test
    public void addnode() throws Exception {
        String con = "localhost:2181";

        RetryPolicy policy = new ExponentialBackoffRetry(1000,3);

        CuratorFramework client = CuratorFrameworkFactory.newClient(con,policy);

        client.start();

        client.create().withMode(CreateMode.EPHEMERAL).forPath("/spider","node".getBytes());

        Thread.sleep(10000);

        client.close();

    }
}
